#ifndef WEATHER_H
#define WEATHER_H

#include <QWidget>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include<QJsonDocument>
#include<QPixmap>
namespace Ui {
class weather;
}

struct WeatherData
{
    QString time;//记录当天查询日期和时间
    QString city;
    QString citykey;
    QString updateTime;
    QString shidu;
    QString quality;
    int pm25 ;
    int pm10;
    QString wendu;
    QString ganmao;

};

struct oneDayData
{

    QString date;
    QString high;
    QString low;
    QString ymd;
    QString week;
    QString sunrise;
    QString sunset;
    int      aqi;
    QString fx;
    QString fl;
    QString type;
    QString notice;

};




class weather : public QWidget
{
    Q_OBJECT

public:
    explicit weather(QWidget *parent = nullptr);
    ~weather();
    WeatherData CityInfo;
    QVector<oneDayData> vhalfmonthData;
    oneDayData yesterday;
    QNetworkAccessManager * manager;
    QPixmap pixmap[25];
    QIcon icon;

    QString weatherch[25]={"晴","多云","强雷雨","雨","局部多云",\
        "日落","雾","大雨","雪","雷雨",\
        "龙卷风","日出","霾","沙尘","夜晚晴朗",\
        "冰雹","冰","炎热","烟霾","微风",\
        "中雨","大雨","小雨","阴","未知"};

    int i;
    int weatherpicture[15];

public slots:
    void replyFinished(QNetworkReply *reply);

private:
    Ui::weather *ui;




};

#endif // WEATHER_H
